        <script type="text/JavaScript">

            var checkboxen = {};

            var htmlCodes = [    
                ["'", '&#39;'],
                ['"', '&quot;'],
                ['>', '&gt;'],
                ['<', '&lt;'],
                ['&', '&amp;']
            ];
            
            function html_decode(s)
            {
             
                for (var c in htmlCodes)
                    s = s.replace(htmlCodes[c][1], htmlCodes[c][0])

                return s
            }
    
            function reload()
            {
                checkboxen = {};
                get_checkboxes();
                reload_list();
                
                reloadMe(20000);
            }
            
            function get_checkboxes()
            {
                $('.playercb').each(function( index, element ) {
                    if ( element.checked )
                    {
                        checkboxen[element.value] = true;
                    }
                });
            }
            
            function set_checkboxes()
            {

                $('.playercb').each(function( index, element ) {
                    if ( checkboxen[element.value] )
                    {
                        element.checked = true
                    }
                });
                
            }
      
            function reload_list()
            {
                
                $.ajax({
                    type: "POST",
                    url: "/",
                    data: {
                        d:"{{ mech.dropid }}",
                        p:html_decode("{{ mech.player }}"),
                        m:"{{ mech.mechtype }}",
                        l:html_decode("{{ mech.loadout }}"),
                        e:"1"
                    },
                    success: function (data, textStatus, jqXHR) {
                        $('#mechlist').html( data );
                        setTimeout("set_checkboxes();",100);
                        
                    },
                    dataType: "html"
                });
                
                
            }
            
             
            function reloadMe(timeoutPeriod) {
                setTimeout("reload();",timeoutPeriod);
            }
   
            $( window ).load(function() { reloadMe(20000) });
        </script>
